﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerObject : MonoBehaviour
{
    public int currentLife
    {
        get
        {
            return GetComponent<PlayerBase>().life;
        }
    }

    public float currentEnergy
    {
        get
        {
            return GetComponent<PlayerBase>().currentEnergy;
        }
    }

    public Vector3 currentPosition
    {
        get
        {
            return transform.position;
        }
    }

    public float currentSpeed
    {
        get
        {
            return GetComponent<Rigidbody2D>().velocity.magnitude;
        }
    }

    public float currentAngle
    {
        get
        {
            if (transform.Find("gun").eulerAngles.z > 360f)
            {
                return transform.Find("gun").eulerAngles.z - 360f;
            }
            if (transform.Find("gun").eulerAngles.z < 0f)
            {
                return transform.Find("gun").eulerAngles.z + 360f;
            }
            return transform.Find("gun").eulerAngles.z;
        }
    }

    public float currentAngleSpeed
    {
        get
        {
            return transform.Find("gun").GetComponent<Rigidbody2D>().angularVelocity;
        }
    }
}